<template>
	<view>
		<!-- <view class="list_attention">
			<image @click="three_center" src="../../../static/me/default.png" mode=""></image>
			<view>
				<text class="big">这里是用户名称文字</text>
				<text class="samell">已卖出：10 已买到：10</text>
				<text @click="cancel" :class="['btnc',sf==false ? 'btns':'']">取消关注</text>
			</view>
		</view> -->
		<view  @click="three_center" class="list_attention" v-for="item in goShu">
			<image :src="item.followHeadImg" mode=""></image>
			<view>
				<text class="big">{{item.followNickName}}</text>
				<text class="samell">已卖出：10 已买到：10</text>
				<text @click="cancel(item.followUserId)" :class="['btns',s==true ? 'btnc':'']">+关注</text>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				sf: true,
				s: false,
				// 循环数据、
				list:'',
				goShu:[
					{
						followld: '00911',
						userld: '123123',
						followUserId: '321321',
						createTime: '5-21',
						nickName: '意义',
						headImg: 'image',
						followNickName: '图',
						followHeadImg: '../../../static/me/default.png'
					},
					{
						followld: '222222',
						userld: '999',
						followUserId: '888',
						createTime: '5-20',
						nickName: '斜斜',
						headImg: 'image2',
						followNickName: '22',
						followHeadImg: '../../../static/me/default.png'
					}
				]
			}
		},
		onLoad(parameter) {
			if (parameter.parameter == 1) {
				uni.setNavigationBarTitle({
					title: '我的关注',
				})
				this.follow()
				this.goAttent()
			} else {
				uni.setNavigationBarTitle({
					title: '我的粉丝'
				})
				this.goAttent2()
			}
		},
		methods: {
			goAttent() {
				var that = this
				that.$http.req.ajax({
				     path: ':8066/web/follow/list',
				     header: {
				     'token': uni.getStorageSync('token')
				     },
					 data: {
					 						 pageNum: '2',
					 						 pageSize: '5'
					 						 
					 },
				     afterAjax: (res) => {
						 		console.log(res,'1111')
								this.list = res.data
				     }
				    })
			},
			goAttent2() {
				var that = this
				that.$http.req.ajax({
				     path: ':8066/web/follow/flist',
					 header: {
					 'token': uni.getStorageSync('token')
					 },
					 data: {
						 pageNum: '2',
						 pageSize: '5'
						 
					 },
				     afterAjax: (res) => {
						 		console.log(res,'12345678')
								this.list = res.data
				     }
				    })
			},
			cancel(gzid) {
				uni.showModal({
					cancelText: '取消',
					title: '取消关注',
					confirmColor: "#FCA022",
					content: '确定取消对该用户的关注？',
					confirmText: '点击确定',
					success: function(res) {
						if (res.confirm) {
							console.log('点击确定')
							var that = this
							that.$http.req.ajax({
							     path: ':8066/web/follow/followUser',
							    header: {
							    'token': uni.getStorageSync('token')
							    },
								 data: {
									followUserId:gzid,
									followType:0
								 },
							     afterAjax: (res) => {
									 		console.log(res,'新增取消成功')
							     }
							    })
						} else if (res.cancel) {
							console.log('点击取消')
							if(res.code == 200) {
								that.goAttent()
							}else {
								uni.showToast({
									title:res.msg
								
								})
							}
						}
					}
				})
			},
			three_center(){
				uni.navigateTo({
					url: '../Personal_Center/Personal_Center'
				});
			},
			// 我的关注
			follow(){
				this.$http.req.ajax({
					path: ':8066/web/follow/list',
					data:{
						token:uni.getStorageSync('usertoken')
					},
					afterAjax: (res) => {
						console.log(res)
					}
				})
			}
		}
	}
</script>

<style>
	.list_attention {
		width: 699rpx;
		height: 155rpx;
		margin: auto;
		border-bottom: 1rpx solid #F5F5F5;
	}

	image {
		width: 79rpx;
		height: 79rpx;
		float: left;
		border-radius: 50%;
		margin-top: 38rpx;
		margin-right: 18rpx;
	}

	.samell {
		width: 434rpx;
		display: block;
		font-size: 21rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #21201D;
		opacity: 0.35;
		float: left;
	}

	.big {
		width: 434rpx;
		font-size: 25rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #21201D;
		opacity: 1;
		margin-top: 36rpx;
		margin-bottom: 18rpx;
		display: inline-block;
		float: left;
	}

	.btnc {
		width: 163rpx;
		height: 65rpx;
		border: 1rpx solid #555555;
		opacity: 0.35;
		border-radius: 32rpx;
		line-height: 65rpx;
		margin-top: 45rpx;
		display: inline-block;
		color: #21201D;
		font-size: 21rpx;
		font-family: PingFang SC;
		opacity: 0.35;
		text-align: center;
		background: #FFFFFF;
	}

	.btns {
		width: 144rpx;
		height: 65rpx;
		background: #FCDA22;
		border-radius: 18px;
		line-height: 65rpx;
		margin-top: 45rpx;
		display: inline-block;
		color: #21201D;
		font-size: 21rpx;
		font-family: PingFang SC;
		opacity: 1;
		text-align: center;
	}
</style>
